class DatabaseObject

  def user
    return -1 if !defined? @user
    $database.users.each {|user|
      if user.id == @user
        return user
      end
    }
  end

  def gallery
    return -1 if !defined? @gallery
    $database.galleries.each {|gallery|
      if gallery.id == @gallery
        return gallery
      end
    }
  end

  def image
    return -1 if !defined? @image
    $database.images.each {|image|
      if image.id == @image
        return image
      end
    }
  end

  def comment
    return -1 if !defined? @comment
    $database.comments.each {|comment|
      if comment.id == @comment
        return comment
      end
    }
  end

  def vote
    return -1 if !defined? @vote
    $database.votes.each {|vote|
      if vote.id == @vote
        return vote
      end
    }
  end
  
end
